package praktikumid.p06_k;

public class Regexp {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String text = "email";
		System.out.println(text.matches("email"));
		System.out.println(text.matches("emai."));
		System.out.println(text.matches("e...."));
		System.out.println("eesti".matches("e...."));
		System.out.println(text.matches("e[abcm]..."));
		System.out.println(text.matches("e[a-m]..."));
		// 0 .. inf
		System.out.println(text.matches("e.*"));
		// 1 .. inf
		System.out.println(text.matches("e.+"));
		// 0 v�i 1
		System.out.println(text.matches("e.?"));
		// 1 .. 4
		System.out.println(text.matches("e.{1,4}"));
		// t�pselt 4 korda
		System.out.println(text.matches("e.{4}"));
		System.out.println("A1231231".matches("A[0-9]{7}"));
		System.out.println("12-1-21".matches("[12-]{7}"));
		System.out.println("12-1-21".matches("[123-]{7}"));
		
		// [A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}
		// ago@mingi.asi.ee
		
		String original = "üks kaks <a title=\"blah\" href=kolm.html> neli viis </a> kuus <a href=seitse> kaheksa </a> üheksa kümme";
		System.out.println(original);
		// üks kaks kolm kuus seitse üheksa kümme
		System.out.println(original.replaceAll("<a href=([a-z.]+)[^>]*>[^<]*</a>", "$1"));
		
		

	}

}
